package com.cby.olive.sample

import android.graphics.Typeface
import android.os.Bundle
import android.view.View
import androidx.fragment.app.Fragment
import com.cby.android.olive.ext.bind
import com.cby.android.olive.ext.start
import com.cby.olive.sample.databinding.FragmentLikeBinding
import com.cby.olive.sample.feature.transition.ui.TransitionHomeActivity

/**
 * Desc：收藏
 * author：Christiano
 * iconFont的使用：https://www.jianshu.com/p/e39b1d506a82
 */
class LikeFragment : Fragment(R.layout.fragment_like) {

    private val binding by lazy { bind<FragmentLikeBinding>() }

    override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
        super.onViewCreated(view, savedInstanceState)
        val typeface = Typeface.createFromAsset(context!!.assets, "ttf/iconfont.ttf")
        binding.tvIcon.typeface = typeface
        // Java这边可以直接设置代码，就可以读取到iconfont的图标
        // kotlin这边需要利用读取res的资源字符串，才可以生效，直接text = “&#xe61d;”
        binding.tvIcon.text = getString(R.string.if_report)

        val typeface2 = Typeface.createFromAsset(activity!!.assets, "fonts2/iconfont.ttf")
        binding.tvIcon2.typeface = typeface2
        binding.tvIcon2.text = getString(R.string.if_android) //getString(R.string.if_report)

        binding.cardTransition.setOnClickListener {
            requireActivity().start(TransitionHomeActivity::class.java)
        }

    }


}